/*
 * Copyright (c) 2001, 2002 Boris Pruessmann and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v0.5
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors:
 *    Boris Pruessmann - Initial implementation.
 */
package net.sourceforge.perforce.ui.model;

import net.sourceforge.perforce.core.PerforceCorePlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;

/**
  * @version $Revision: 22 $
  * @author  <a href="mailto:bpruessmann@users.sourceforge.net">Boris Pruessmann</a>
  */
public class AllRootsElement implements IWorkbenchAdapter, IAdaptable
{
	// ---------------------------------------------------------- Public Methods (IWorkbenchAdapter)
	
	/** @see IWorkbenchAdapter#getChildren(Object) */
	public Object[] getChildren(Object o)
	{
		return PerforceCorePlugin.getServerManager().getPerforceServers();
	}

	/** @see IWorkbenchAdapter#getImageDescriptor(Object) */
	public ImageDescriptor getImageDescriptor(Object object)
	{
		return null;
	}

	/** @see IWorkbenchAdapter#getLabel(Object) */
	public String getLabel(Object o)
	{
		return null;
	}

	/** @see IWorkbenchAdapter#getParent(Object) */
	public Object getParent(Object o)
	{
		return null;
	}

	// ------------------------------------------------------------------------------ Public Methods

	/** @see IAdaptable#getAdapter(Class) */
	public Object getAdapter(Class adapter)
	{
		return (adapter == IWorkbenchAdapter.class) ? this : null;
	}
}
